package com.belle.sfsdfasdfsdf.support;

import com.belle.sfsdfasdfsdf.domain.ScheduleJob;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * 任务工厂
 * @author sxl
 * @date 2018/9/18 0018 14:05
 */
public class QuartzJobFactory implements Job {
	public void execute(JobExecutionContext context) throws JobExecutionException {
		ScheduleJob scheduleJob = (ScheduleJob) context.getMergedJobDataMap().get("scheduleJob");
		if("group1".equals(scheduleJob.getJobGroup()) && "job1".equals(scheduleJob.getJobName())) {
			System.out.println("1组 1任务 cron: " + scheduleJob.getCronExpression() + " 正在执行!");
			//TODO 任务逻辑
		}
		if("group2".equals(scheduleJob.getJobGroup()) && "job2".equals(scheduleJob.getJobName())) {
			System.out.println("2组 2任务 cron: " + scheduleJob.getCronExpression() + " 正在执行!");
			//TODO 任务逻辑
		}
		//TODO ...
	}
}
